<html xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui" >  

    <ui:composition template="layout.xhtml">
        <ui:define name="corpo">
            <h:form id="index_form" acceptcharset="utf-8"> 
                <div id="breadcrumb">
                    <p:commandLink  actionListener="#{managerIndex.redirect('index.xhtml')}" value="Inicio" update="@form" immediate="true"/> >
                    <p:commandLink  actionListener="#{managerIndex.redirect('config.xhtml')}" value="Configurações" update="@form" immediate="true"/> >
                    <p:commandLink  value="Cartório" update="@form" immediate="true"/>
                </div>
                <p:panel header="Principal - Cartório">
                    <br/>
                    <h:panelGrid style="float: right;" columns="4">
                        <p:graphicImage url="/media/img/new.png" title="Cadastrar Cartorio" /> <p:commandLink   value="Cadastrar" title="Cadastrar Cartorio" actionListener="#{managerCartorio.redirect('criarCartorio.xhtml')}" update="@form"/>
                        <p:graphicImage url="/media/img/search.png" title="Pesquisar Cartorio"/><p:commandLink value="Pesquisar" title="Pesquisar Cartorio" actionListener="#{managerCartorio.redirect('buscarCartorio.xhtml')}" update="@form"/>
                    </h:panelGrid>
                    <br/>
                    <br/>
                    <p:dataTable id="pessoaTable" var="cartorio" value="#{managerVisualizarCartorio.todos()}" 
                                 paginator="true" rows="5"
                                 paginatorPosition="bottom"
                                 paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"  
                                 rowsPerPageTemplate="5,10,15">     

                        <f:facet name="header">  
                              Cartórios Cadastrados
                        </f:facet>
                        <p:column style="width:400px;">  
                            <f:facet name="header" >   
                                Nome
                            </f:facet>  
                            <h:outputText value="#{cartorio.nome}" />  
                        </p:column>
                        <p:column style="width:200px;">  
                            <f:facet name="header" >   
                                Fantasia
                            </f:facet>  
                            <h:outputText value="#{cartorio.fantasia}" />  
                        </p:column>

                        <p:column style="width:200px;">  
                            <f:facet name="header" >   
                                Logradouro
                            </f:facet>  
                            <h:outputText value="#{cartorio.endereco.logradouro}" />  
                        </p:column> 
                        <p:column style="width:200px;">  
                            <f:facet name="header" >   
                                Cep
                            </f:facet>  
                            <h:outputText value="#{cartorio.endereco.cep}" />  
                        </p:column>
                        <p:column style="width:200px;">  
                            <f:facet name="header" >   
                                Telefone
                            </f:facet>  
                            <h:outputText value="#{cartorio.endereco.telefone}" />  
                        </p:column>
                        <p:column style="width:80px;">  
                            <f:facet name="header">  
                                <h:outputText value="Opções" />   
                            </f:facet>
                            <p:commandButton  icon="editar" actionListener="#{managerEditarCartorio.redirect('editarCartorio.xhtml',cartorio)}" update="@form"/> 
                            <p:commandButton  icon="view" actionListener="#{managerVisualizarCartorio.redirect('visualizarCartorio.xhtml', cartorio)}" update="@form"/>   


                        </p:column>    
                    </p:dataTable> 

                </p:panel>
            </h:form>
        </ui:define>
    </ui:composition>
</html>